<template>
  <div id="propertyIndex">
    <div class="topBox">
      <img class="topImg" src="../../assets/images/movebricks_bg.png" alt="" />
      <div class="dataBox">
        <div class="title">资产</div>
        <div class="data">282434.000000<span>USDT</span></div>
      </div>
    </div>

    <div class="box">
      <Grid :column-num="3">
        <GridItem
          v-for="(item, index) in GridItem"
          :key="index"
          :text="item"
          @click="onrecharge(index)"
        >
          <img
            class="gridImg"
            slot="icon"
            src="@/assets/images/ic_recharge_coin.png"
          />
        </GridItem>
      </Grid>

      <tabs class="tabBox" v-model="active">
        <tab
          :title="item"
          v-for="(item, index) in tabItem"
          :key="index"
          :text="item"
        />
      </tabs>

      <div
        :class="dataIndex == index ? 'dataBox' : 'dataBox clickDataBox'"
        v-for="(item, index) in 5"
        :key="item"
        @click="clickDataBox(index)"
      >
        <div class="title">USDT</div>
        <div class="datas">
          <div>
            <span>可用(USDT)</span>
            <span>191789.402897</span>
          </div>
          <div>
            <span>可用(USDT)</span>
            <span>191789.402897</span>
          </div>
          <div>
            <span>可用(USDT)</span>
            <span>191789.402897</span>
          </div>
        </div>
      </div>
    </div>

    <Tabbar></Tabbar>
  </div>
</template>

<script>
import Tabbar from "@/components/Tabbar.vue";
import { Grid, GridItem, Tab, Tabs } from "vant";
export default {
  components: {
    Tabbar,
    Grid,
    GridItem,
    Tab,
    Tabs,
  },
  data() {
    return {
      GridItem: ["充值", "提现", "兑换"],
      tabItem: ["账户资产", "币币资产"],
      active: 0, //tab数值
      dataIndex: 0,
    };
  },
  methods: {
    //点击资产
    clickDataBox(index) {
      this.dataIndex = index;
    },

    onrecharge(index) {
      if (index === 0) {
        this.$router.push({
          path: "/recharge",
        });
      } else if (index === 1) {
        this.$router.push({
          path: "/withdraw",
        });
      }else if(index === 2){ 
        this.$router.push({
          path: "/exchange",
        });
      }
    },
  },
};
</script>

<style lang="less" scoped>
#propertyIndex {
  .topBox {
    position: relative;
    color: #fff;
    .topImg {
      position: absolute;
      top: 0;
      width: 100vw;
      z-index: -1;
    }
    .dataBox {
      display: flex;
      flex-direction: column;
      align-content: center;
      justify-content: center;
      height: 170px;
      .title {
        text-align: center;
        font-size: 16px;
      }
      .data {
        text-align: center;
        font-size: 32px;
        font-weight: 700;
        margin-top: 10px;
        span {
          font-size: 20px;
          padding-left: 4px;
        }
      }
    }
  }

  .box {
    padding-bottom: 50px;
    background-color: #f7f6fb;
    /deep/.gridImg {
      height: 40px;
    }
    .tabBox {
      /deep/.van-tabs__wrap {
        margin: 10px 0;
      }
      /deep/.van-tab--active {
        font-size: 15px;
        color: rgb(41, 121, 255);
        font-weight: bold;
      }
      /deep/.van-tabs__line {
        width: 20px;
        background-color: rgb(41, 121, 255);
        height: 3px;
        border-radius: 3px;
      }
    }
    .dataBox {
      width: 95%;
      margin: auto;
      background: #fff;
      border-radius: 10px;
      margin-bottom: 10px;
      .title {
        padding: 0 10px;
        color: #000;
        font-size: 18px;
        font-weight: 600;
        line-height: 50px;
        margin-bottom: 10px;
      }
      .datas {
        display: flex;
        div {
          display: flex;
          flex-direction: column;
          align-items: center;
          justify-content: center;
          width: 33.33%;
          span {
            margin-bottom: 7px;
          }
        }
      }
    }
    .clickDataBox {
      background: #fafafa;
    }
  }
}
</style>
